package me.youline.dataServer.service.authentication;

import me.youline.dataServer.entity.UserToken;

import org.apache.shiro.authc.AuthenticationToken;

public class UserAuthenticationToken implements AuthenticationToken {

	private static final long serialVersionUID = 6905705400117838550L;

	private final UserToken token;

	public UserAuthenticationToken(UserToken userToken) {
		this.token = userToken;
	}

	public UserAuthenticationToken(String token) {
		UserToken userToken = new UserToken();
		userToken.setToken(token);
		this.token = userToken;
	}

	@Override
	public Object getPrincipal() {
		return token.getToken();
	}

	@Override
	public Object getCredentials() {
		return token.getUserId();
	}

}
